package cn.edu.lit.jsjxy.CourseExample.chapter5;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import cn.edu.lit.jsjxy.CourseExample.R;

public class MainActivity_Chap5 extends Activity implements View.OnClickListener
{

    Button btnStartedService,btnBindServcie,btnIntentService,btnReceiver,btnMusicReceiver,btnNotification;
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main__chap5);

        btnStartedService = findViewById(R.id.btnStartedService);
        btnBindServcie = findViewById(R.id.btnBindService);
        btnIntentService = findViewById(R.id.btnIntentService);
        btnReceiver = findViewById(R.id.btnReceiver);
        btnMusicReceiver = findViewById(R.id.btnMusicReceiver);
        btnNotification = findViewById(R.id.btnNotification);

        btnStartedService.setOnClickListener(this);
        btnBindServcie.setOnClickListener(this);
        btnIntentService.setOnClickListener(this);
        btnReceiver.setOnClickListener(this);
        btnMusicReceiver.setOnClickListener(this);
        btnNotification.setOnClickListener(this);
    }

    @Override
    public void onClick(View view)
    {
        Intent intent = new Intent();
        switch (view.getId())
        {
            case R.id.btnStartedService:
                intent.setClass(this, MusicPlayActivity.class);
                break;
            case R.id.btnBindService:
                intent.setClass(this, ServiceTestActivity.class);

                break;
            case R.id.btnIntentService:
                break;

            case R.id.btnReceiver:
                intent.setClass(this, ReceiverTestActivity.class);
                break;

            case R.id.btnMusicReceiver:
                intent.setClass(this, MusicReceiverTestActivity.class);
                break;

            case R.id.btnNotification:
                intent.setClass(this, NotificationTestActivity.class);

                break;
        }
        startActivity(intent);
    }
}
